package com.tuozixuan.quarkus.resource;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;

@Path("/hello")
public class GreetingResource {

	@GET
	@Produces(MediaType.TEXT_PLAIN)
	public String hello() {
		return "hello";
	}
	
	@GET
	@Produces(MediaType.TEXT_PLAIN)
	@Path("/hello1")
	public String hello1() {
		return "hello1";
	}
	
	@POST
	@Produces(MediaType.TEXT_PLAIN)
	@Path("/create")
	public String create() {
		System.out.println("create");
		return "create";
	}
	
	@POST
	@Produces(MediaType.TEXT_PLAIN)
	@Consumes(MediaType.TEXT_PLAIN)
	@Path("/create1")
	public String create1(String message) {
		System.out.println("create1");
		return "create1";
	}
	
	@GET
	@Produces(MediaType.TEXT_PLAIN)
	@Path("/hello2")
	public String hello2(@Context UriInfo uriInfo, @QueryParam("message") String message) {
		
		return String.format("URI:%s message:%s", uriInfo.getAbsolutePath(), message);
	}
}
